<style>
    .layui-form-label {
        width: 100px;
    }

    .layui-input-block {
        margin-left: 130px;
    }
</style>
<div class="rightcontent rc-bg-grey">
    <div class="rc-pagepadding ">
        <div class=" rc-pannel layui-form">
            <div class=" rc-pannel-header rc-pagepadding rc-bold">
                <i class="iconfont goback rc-pointer">&#xe62b;</i> 添加站点
            </div>
            <div class="rc-pannel-body  rc-pagepadding">

                <div class="layui-form-item">
                    <label class="layui-form-label">站点标识</label>
                    <div class="layui-input-block">
                        <input type="text" name="ident" autocomplete="off" value="" lay-verify="required" class="layui-input" />

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">站点名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" autocomplete="off" value="" lay-verify="required" class="layui-input" />

                    </div>
                </div>



                <div class="layui-form-item">
                    <label class="layui-form-label">站点域名
                        <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="域名不需要填写HTTP/HTTPS,如有端口请带上端口" style=" color: #7D8388;"></i>
                    </label>

                    <div class="layui-input-block">
                        <div class="layui-input-group" style="width: 100%;">
                            <div class="" style="width:100px" id="">
                                <select name="protocol">
                                    <option value="http://">http://</option>
                                    <option value="https://">https://</option>
                                </select>
                            </div>
                            <input type="text" name="domain" autocomplete="off" value="" lay-verify="required" class="layui-input" />

                        </div>

                    </div>


                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">绑定单位
                        <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="这一步不是必须填写，如需要方便其他应用扩展可填写" style=" color: #7D8388;"></i>
                    </label>
                    <div class="layui-input-block">
                        <?php echo element('organcascader', name: "orgid"); ?>

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-block">
                        <input type="text" name="keyword" autocomplete="off" value="" class="layui-input" />

                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">简介描述</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="desc"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">icp备案号
                        <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="支持HTML代码"></i>
                    </label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="icp"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">统计代码
                        <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="支持HTML代码"></i>
                    </label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="statistics"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">站点主题
                        <i class="layui-icon layui-icon-question rc-tips rc-pointer" message="站点主题不是必须，如果填写，则前台模板路径为/template/home/站点标识/主题" style=" color: #7D8388;"></i>
                    </label>
                    <div class="layui-input-block">
                        <input type="text" name="theme" autocomplete="off" value="" class="layui-input" />

                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <select name="status">
                            <option value="1">正常</option>
                            <option value="-1">关闭</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item rc-margin-bottom0">
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" lay-submit lay-filter="submit">提交</button>
                        <button type="reset" class="layui-btn layui-btn-sm">重置</button>
                    </div>
                </div>

            </div>



        </div>

    </div>
</div>

<script>
    layui.use(function() {

        var form = layui.form;
        form.on('submit(submit)', function(data) {
            var fielddata = data.field;
            if (fielddata['orgid'] == '') {
                delete fielddata['orgid'];
            }
            $.ajax({
                url: '/admin/cnf/Site/add', //请求路径
                type: "POST", //请求方式
                data: data.field, // 默认写法
                success: function(data) {
                    if (data.code == 0) {
                        toastr_success("添加成功", function() {
                            window.location.href = '/admin/cnf/Site/index';
                        });
                    } else {
                        toastr_error(data.message);
                    }
                },
                error: function() {

                },

            });
        });



    });
</script>